#include "../source/Server_version1.hpp"
#include <string>
int main()
{
    std::string ip = "127.0.0.1";
    u_int16_t port = 9999;

    muduo::Socket cli_socket;
    cli_socket.CreateClient(port, ip);
    std::string msg = "hello world";
    cli_socket.Send(msg.c_str(), msg.size());
    std::string echo;

    char buffer[1024];
    bzero(buffer,sizeof(buffer));
    while (1)
    {
        int n = cli_socket.Recv(buffer, sizeof(buffer) - 1);
        DBG_LOG("n:%d", n);
        buffer[n] = 0;
        std::cout << "buffer: " << buffer << std::endl;

        DBG_LOG("echo: %s", buffer);
        echo.append(buffer, n);
        DBG_LOG("echo: %s", echo.c_str());
    }
    cli_socket.Close();
}